package Controller.Actions.GetAll;

import Controller.*;
import java.io.*;
import java.net.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import Model.Beans.Results.*;
import Model.Beans.*;
import Model.QBE.*;

public class GetAllStudentsAction implements Action {
    
    private String name;
    
    public GetAllStudentsAction() 
    {
        this.name = "GetAllStudents";
    }
    
    public String getName()
    {
        return name;
    }
    
    public void perform(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    {
        StudentModel model = new StudentModel();
        
        PersonList list = model.search(new Person());
        response.setContentType("text/xml");
        response.setHeader("Cache-Control", "no-cache");
        
        if(list != null)
        {
            response.getWriter().write(list.toXML());
        }
        else
        {
            PersonList listt = new PersonList();
            response.getWriter().write(listt.toXML());
        }
    }
}
